<div class="card mb-3">
  <div class="card-header">
    <h3 class="card-title mb-0 h5"><%= Spree.t(:summary) %></h3>
  </div>
  <div class="table-responsive">
  <table class="table table-condensed table-bordered" id="order_tab_summary" data-hook>
    <tbody class="additional-info">
      <tr>
        <td id="order_status" width="35%" data-hook>
          <strong><%= Spree.t(:status) %>:</strong>
        </td>
        <td>
          <span class="state badge badge-<%= @order.state %> text-uppercase">
            <%= Spree.t(@order.state, scope: :order_state) %>
          </span>
        </td>
      </tr>
      <tr>
        <td data-hook='admin_order_tab_channel_title'>
          <strong><%= Spree.t(:channel) %>:</strong>
        </td>
        <td id='order_channel'><%= @order.channel %></td>
      </tr>
      <tr>
        <td data-hook='admin_order_tab_subtotal_title'>
          <strong><%= Spree.t(:subtotal) %>:</strong>
        </td>
        <td id='item_total'>
          <%= @order.display_item_total.to_html %>
        </td>
      </tr>

      <% if @order.checkout_steps.include?("delivery") && @order.ship_total > 0 %>
        <tr>
          <td data-hook='admin_order_tab_ship_total_title'>
            <strong><%= Spree.t(:ship_total) %>:</strong>
          </td>
          <td id='ship_total'>
            <%= @order.display_ship_total.to_html %>
          </td>
        </tr>
      <% end %>

      <% if @order.included_tax_total != 0 %>
        <tr>
          <td data-hook='admin_order_tab_included_tax_title'>
            <strong><%= Spree.t(:tax_included) %>:</strong>
          </td>
          <td id='included_tax_total'>
            <%= @order.display_included_tax_total.to_html %>
          </td>
        </tr>
      <% end %>

      <% if @order.additional_tax_total != 0 %>
        <tr>
          <td data-hook='admin_order_tab_additional_tax_title'>
            <strong><%= Spree.t(:tax) %>:</strong>
          </td>
          <td id='additional_tax_total'>
            <%= @order.display_additional_tax_total.to_html %>
          </td>
        </tr>
      <% end %>

      <tr>
        <td data-hook='admin_order_tab_total_title'>
          <strong><%= Spree.t(:total) %>:</strong>
        </td>
        <td id='order_total'><%= @order.display_total.to_html %></td>
      </tr>

      <% if @order.completed? %>
        <% if @order.shipment_state.present? %>
          <tr>
            <td>
              <strong><%= Spree.t(:shipment) %>:</strong>
            </td>
            <td id='shipment_status'>
              <span class="state badge badge-<%= @order.shipment_state %> text-uppercase">
                <%= Spree.t(@order.shipment_state, scope: :shipment_states, default: [:missing, "none"]) %>
              </span>
            </td>
          </tr>
        <% end %>
        <% if @order.payment_state.present? %>
          <tr>
            <td>
              <strong><%= Spree.t(:payment) %>:</strong>
            </td>
            <td id='payment_status'>
              <span class="state badge badge-<%= @order.payment_state %> text-uppercase">
                <%= Spree.t(@order.payment_state, scope: :payment_states, default: [:missing, "none"]) %>
              </span>
            </td>
          </tr>
        <% end %>
        <tr>
          <td data-hook='admin_order_tab_date_completed_title'>
            <strong><%= Spree.t(:date_completed) %>:</strong>
          </td>
          <td id='date_complete'>
            <%= pretty_time(@order.completed_at) %>
          </td>
        </tr>
      <% end %>

      <% if @order.approved? %>
        <tr>
          <td><strong><%= Spree.t(:approver) %></strong></td>
          <td><%= @order.approver.try(:email) %></td>
        </tr>
        <tr>
          <td><strong><%= Spree.t(:approved_at) %></strong></td>
          <td><%= pretty_time(@order.approved_at) %></td>
        </tr>
      <% end %>

      <% if @order.canceled? && @order.canceler && @order.canceled_at %>
        <tr>
          <td><strong><%= Spree.t(:canceler) %></strong></td>
          <td><%= @order.canceler.email %></td>
        </tr>
        <tr>
          <td><strong><%= Spree.t(:canceled_at) %></strong></td>
          <td><%= pretty_time(@order.canceled_at) %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
  </div>
</div>
